<?php
use Encore\Admin\Facades\Admin;
use Illuminate\Support\Facades\Route;
 

// Route::prefix('admin')->namespace('\App\Admin\Controllers')->middleware(['admin'])->group(function () {
  
//     // SPA路由放在最后，作为fallback
//     Route::any('{any?}', 'SpaController@index')->where('any', '.*');
// });

Route::get('test', function() {
    return '路由测试成功';
});



// 确保这行存在，注册 Laravel-Admin 内置路由
Admin::routes();

Route::get('spa/{any?}', [\App\Admin\Controllers\SpaController::class, 'index'])->where('any', '.*');


// 自定义路由 - 使用 admin 中间件组
Route::group([
    'prefix'        => config('admin.route.prefix'),
    'namespace'     => config('admin.route.namespace'),
    'middleware'    => config('admin.route.middleware'),
], function () {
    // 你的自定义路由
    // Route::get('spa/{page}', 'SpaController@index');
    Route::get('spa/{any?}', [\App\Admin\Controllers\SpaController::class, 'index'])->where('any', '.*');
});
